home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2001 May / SGI IRIX Base Documentation 2001 May.iso / usr / share / catman / p_man / cat3c / getgrent.z / getgrent
Encoding:
Text File  |  1998-10-20  |  10.1 KB  |  199 lines

  1.  
  2.  
  3.  
  4. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      getgrent, getgrent_r, getgrgid, getgrgid_r, getgrnam, getgrnam_r,
  10.      setgrent, endgrent, fgetgrent, fgetgrent_r - get group file entry
  11.  
  12. SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  13.      ####iiiinnnncccclllluuuuddddeeee <<<<ggggrrrrpppp....hhhh>>>>
  14.  
  15.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  16.  
  17.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrreeeennnntttt____rrrr((((ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  18.  
  19.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrrggggiiiidddd((((ggggiiiidddd____tttt ggggiiiidddd))));;;;
  20.  
  21.      iiiinnnntttt ggggeeeettttggggrrrrggggiiiidddd____rrrr((((ggggiiiidddd____tttt ggggiiiidddd,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ********ggggrrrrpppp))));;;;
  22.  
  23.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggeeeettttggggrrrrnnnnaaaammmm((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee))));;;;
  24.  
  25.      iiiinnnntttt ggggeeeettttggggrrrrnnnnaaaammmm____rrrr((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ********ggggrrrrpppp))));;;;
  26.  
  27.      vvvvooooiiiidddd sssseeeettttggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  28.  
  29.      vvvvooooiiiidddd eeeennnnddddggggrrrreeeennnntttt((((vvvvooooiiiidddd))));;;;
  30.  
  31.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ffffggggeeeettttggggrrrreeeennnntttt((((FFFFIIIILLLLEEEE ****ffff))));;;;
  32.  
  33.      ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ffffggggeeeettttggggrrrreeeennnntttt____rrrr((((FFFFIIIILLLLEEEE ****ffff,,,, ssssttttrrrruuuucccctttt ggggrrrroooouuuupppp ****ggggrrrreeeennnntttt,,,, cccchhhhaaaarrrr ****bbbbuuuuffffffffeeeerrrr,,,, iiiinnnntttt bbbbuuuuffffssssiiiizzzzeeee))));;;;
  34.  
  35.      iiiinnnntttt ggggeeeettttggggrrrrmmmmeeeemmmmbbbbeeeerrrr((((ccccoooonnnnsssstttt cccchhhhaaaarrrr ****nnnnaaaammmmeeee,,,, ggggiiiidddd____tttt ggggiiiidddd____aaaarrrrrrrraaaayyyy[[[[]]]],,,, iiiinnnntttt mmmmaaaaxxxxggggiiiiddddssss,,,, iiiinnnntttt vvvvggggiiiiddddssss))));;;;
  36.  
  37. DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  38.      _g_e_t_g_r_e_n_t, _g_e_t_g_r_g_i_d and _g_e_t_g_r_n_a_m and their reentrant counterparts each
  39.      return pointers to an object with the following structure containing the
  40.      broken-out fields of a line in the /_e_t_c/_g_r_o_u_p file or some other back-end
  41.      group database.  Each line contains a ``group'' structure, defined in the
  42.      <_g_r_p._h> header file.
  43.  
  44.           struct group {
  45.                  char    *gr_name;   /* the name of the group */
  46.                  char    *gr_passwd; /* the encrypted group password */
  47.                  gid_t   gr_gid;     /* the numerical group ID */
  48.                  char    **gr_mem;   /* vector of pointers to member names */
  49.           };
  50.  
  51.      _g_e_t_g_r_e_n_t when first called returns a pointer to the first group structure
  52.      in the file; thereafter, it returns a pointer to the next group structure
  53.      in the file; so, successive calls may be used to search the entire file.
  54.      _g_e_t_g_r_g_i_d searches from the beginning of the file until a numerical group
  55.      id matching _g_i_d is found and returns a pointer to the particular
  56.      structure in which it was found.  _g_e_t_g_r_n_a_m searches from the beginning of
  57.      the file until a group name matching _n_a_m_e is found and returns a pointer
  58.      to the particular structure in which it was found.  If an end-of-file or
  59.      an error is encountered on reading, these functions return a NULL
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  71.  
  72.  
  73.  
  74.      pointer.
  75.  
  76.      The _g_e_t_g_r_n_a_m__r and _g_e_t_g_r_g_i_d__r calls are reentrant versions of the
  77.      _g_e_t_g_r_n_a_m and _g_e_t_g_r_g_i_d calls.   The extra arguments grent and buffer are
  78.      used for internal storage, bufsize is size of buffer, and grp is the
  79.      struct group used to return the requested information.  A good size of
  80.      buffer is BUFSIZ bytes.
  81.  
  82.      A call to _s_e_t_g_r_e_n_t has the effect of rewinding the group file to allow
  83.      repeated searches.  _e_n_d_g_r_e_n_t may be called to close the group file when
  84.      processing is complete.
  85.  
  86.      _f_g_e_t_g_r_e_n_t returns a pointer to the next group structure in the stream _f,
  87.      which matches the format of ////eeeettttcccc////ggggrrrroooouuuupppp.
  88.  
  89. NNNNOOOOTTTTEEEESSSS
  90.      In IRIX 4.0, there were two versions of the getpwent primitives:  the
  91.      standard version in libc and the NIS version in libsun.  This release
  92.      contains only routines to parse files, an external file supply mechanism
  93.      nsd(1) supplies data from NIS and other protocols as files.  To force
  94.      these routines to not use nsd supplied data set the external
  95.      __g_e_t_p_w_e_n_t__n_o__y_p variable to 1. This is useful for programs that must not
  96.      generate any network traffic, and for programs that update the /_e_t_c/_g_r_o_u_p
  97.      file.
  98.  
  99.  
  100.      _g_e_t_g_r_m_e_m_b_e_r is used to get the ids of the groups of which the given user
  101.      is a member.  _n_a_m_e is the name of the user.  The group ids are returned
  102.      in the array _g_i_d__a_r_r_a_y which contains _m_a_x_g_i_d_s elements.  The first _v_g_i_d
  103.      elements of _g_i_d__a_r_r_a_y are not used by _g_e_t_g_r_m_e_m_b_e_r and can be used by the
  104.      caller to initialize default group ids.  _g_e_t_g_r_m_e_m_b_e_r is usually called by
  105.      _i_n_i_t_g_r_o_u_p_s. _g_e_t_g_r_m_e_m_b_e_r returns the number of valid gids in the gid array
  106.      or -1 if an error is encountered.
  107.  
  108.      The Mips ABI specifies nothing but local files so applications which wish
  109.      to use anything else must compile with libc prior to libnsl in the
  110.      library list.
  111.  
  112.      When nsd is running changes in the group file may not be seen by
  113.      getgrent() until the nsd enumeration cache file has timed out.
  114.  
  115. DDDDIIIIAAAAGGGGNNNNOOOOSSSSTTTTIIIICCCCSSSS
  116.      All routines that return a struct group * will return a NULL pointer in
  117.      the case of EOF or failure. The reentrant functions return the errno(3C)
  118.      for the call, and thus 0 implies success.  The getgrmember call returns
  119.      the number of gids found, and -1 on failure.
  120.  
  121. FFFFIIIILLLLEEEESSSS
  122.      /etc/group /var/ns/cache/group.byname.m /var/ns/cache/group.bygid.m
  123.      /var/ns/cache/group.bymember.m
  124.  
  125.  
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))                                                      GGGGEEEETTTTGGGGRRRREEEENNNNTTTT((((3333CCCC))))
  137.  
  138.  
  139.  
  140. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  141.      nsd(1M), getgroups(2), errno(3C), getlogin(3C), getpwent(3C), group(4).
  142.  
  143. WWWWAAAARRRRNNNNIIIINNNNGGGG
  144.      The above routines use the _s_t_d_i_o library, which causes them to increase
  145.      the size of programs, not otherwise using standard I/O, more than might
  146.      be expected.  They also map an external cache file which can cause the
  147.      application to be larger than expected.
  148.  
  149.  
  150.  
  151.  
  152.  
  153.  
  154.  
  155.  
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172.  
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.